

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>iframe</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../layui/css/layui.css" media="all">
  <style>
    body{padding:10px; font-size:14px; background:#fff; width:95%; margin:0 auto; font-size:14px; line-height:20px; overflow:hidden;}
    p{margin-bottom:10px;}
    input{border:1px solid #999; padding:5px 10px; margin:0 10px 10px 0;}
  </style>
</head>
<body>



<form id="form">
  <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
    <div class="layui-form-item">
      <label class="layui-form-label">客户 id</label>
      <div class="layui-input-inline">
        <input type="hidden" name="id">
        <!--        <input type="text" name="cusId" lay-verify="required" placeholder="请输入客户 id" autocomplete="off" class="layui-input">-->
        <select name="cusId" id="select_cus">-->
          //自动填充的客户信息
        </select>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">token 内容</label>
      <div class="layui-input-block">
        <input type="text" name="accessToken" lay-verify="required" placeholder="token 内容" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">开始时间</label>
      <div class="layui-input-inline" id="startDateDiv" ></div>
      <div class="layui-input-inline" id="startTimeyDiv" style="margin-left: 80px;"></div>
<!--      <div class="layui-input-inline">-->
        <input id="startDate" type="hidden" name="startDate" lay-verify="required" placeholder="开始日期" value="" autocomplete="off" class="layui-input">
        <input id="startTimey" type="hidden" name="startTimey" lay-verify="required" placeholder="开始时间" value="" autocomplete="off" class="layui-input">
<!--      </div>-->
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">结束时间</label>
      <div class="layui-input-inline" id="expireDateDiv" ></div>
      <div class="layui-input-inline" id="expireTimeyDiv" style="margin-left: 80px;"></div>
<!--      <div class="layui-input-inline">-->
        <input id="expireDate" type="hidden" name="expireDate" lay-verify="required" placeholder="结束日期" value="" autocomplete="off" class="layui-input">
        <input id="expireTimey" type="hidden" name="expireTimey" lay-verify="required" placeholder="结束时间" value="" autocomplete="off" class="layui-input">
<!--      </div>-->
    </div>

    <div class="layui-form-item layui-hide">
      <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
    </div>
  </div>
</form>



<script src="../layui/layui.js"></script>

<script>
  layui.config({
    base: '../layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form'], function(){
    var $ = layui.$;
    // ,form = layui.form;




  });
  function refresh() {
    layui.use('form', function(){
      var form = layui.form;
      form.render();
      form.render('select','test');

    });
  }
</script>


<script>
  layui.use('layer','laydate', function(){
    var $ = layui.$
            ,layer = layui.layer
            ,form = layui.form
            ,index = parent.layer.getFrameIndex(window.name); //获取窗口索引
    var laydate = layui.laydate;
    // laydate.render({
    //   type:'date',
    //   elem: '#startDateDiv'
    //   ,position: 'static'
    //   ,value: new Date()
    //   ,trigger: 'click'
    //   ,change: function(value, date){ //监听日期被切换
    //     lay('#startDate').attr('value',value);
    //   }
    //   ,ready: function(value, date){
    //     lay('#startDate').attr('value','2018-08-20');
    //   }
    // });
    // laydate.render({
    //   type:'time',
    //   elem: '#startTimeyDiv'
    //   ,position: 'static'
    //   ,value: new Date(1534766888000)
    //   ,trigger: 'click'
    //   ,change: function(value, date){ //监听日期被切换
    //     lay('#startTimey').attr('value',value);
    //   }
    //   ,ready: function(value, date){
    //     lay('#startTimey').attr('value','20:08:08');
    //   }
    // });
    // laydate.render({
    //   type:'date',
    //   elem: '#expireDateDiv'
    //   ,position: 'static'
    //   ,value: new Date()
    //   ,trigger: 'click'
    //   ,change: function(value, date){ //监听日期被切换
    //     lay('#expireDate').attr('value',value);
    //   }
    //   ,ready: function(value, date){
    //     lay('#expireDate').attr('value','2018-08-20');
    //   }
    // });
    // laydate.render({
    //   type:'time',
    //   elem: '#expireTimeyDiv'
    //   ,position: 'static'
    //   ,value: new Date(1534766888000)
    //   ,trigger: 'click'
    //   ,change: function(value, date){ //监听日期被切换
    //     lay('#expireTimey').attr('value',value);
    //   }
    //   ,ready: function(value, date){
    //     lay('#expireTimey').attr('value','20:08:08');
    //   }
    // });


    var active = {
      close: function(set){
        parent.layer.close(index);
      }

    }

    // $('.layui-btn-container .layui-btn').on('click', function(){
    //   var othis = $(this)
    //           ,type = othis.data('type');
    //   active[type] && active[type].call(this);
    // });
  });
  
  function flushDate() {
    layui.use(['laydate'], function() {
      var laydate = layui.laydate;
      laydate.render({
        type:'date',
        elem: '#startDateDiv'
        ,position: 'static'
        ,value: new Date()
        ,trigger: 'click'
        ,change: function(value, date){ //监听日期被切换
          lay('#startDate').attr('value',value);
        }
        ,ready: function(value, date){
          lay('#startDate').attr('value','2018-08-20');
        }
      });
      laydate.render({
        type:'time',
        elem: '#startTimeyDiv'
        ,position: 'static'
        ,value: new Date(1534766888000)
        ,trigger: 'click'
        ,change: function(value, date){ //监听日期被切换
          lay('#startTimey').attr('value',value);
        }
        ,ready: function(value, date){
          lay('#startTimey').attr('value','20:08:08');
        }
      });
      laydate.render({
        type:'date',
        elem: '#expireDateDiv'
        ,position: 'static'
        ,value: new Date()
        ,trigger: 'click'
        ,change: function(value, date){ //监听日期被切换
          lay('#expireDate').attr('value',value);
        }
        ,ready: function(value, date){
          lay('#expireDate').attr('value','2018-08-20');
        }

      });
      laydate.render({
        type:'time',
        elem: '#expireTimeyDiv'
        ,position: 'static'
        ,value: new Date(1534766888000)
        ,trigger: 'click'
        ,change: function(value, date){ //监听日期被切换
          lay('#expireTimey').attr('value',value);
        }
        ,ready: function(value, date){
          lay('#expireTimey').attr('value','20:08:08');
        }
      });
    });


  }


  function editDate(startDate,startTimey,expireDate,expireTimey) {
    layui.use(['laydate'], function() {
      var laydate = layui.laydate;
      laydate.render({
        type:'date',
        elem: '#startDateDiv'
        ,position: 'static'
        ,value: new Date()
        ,trigger: 'click'
        ,change: function(value, date){ //监听日期被切换
          lay('#startDate').attr('value',value);
        }
        ,ready: function(value, date){
          lay('#startDate').attr('value',startDate);
        }
      });
      laydate.render({
        type:'time',
        elem: '#startTimeyDiv'
        ,position: 'static'
        ,value: new Date(1534766888000)
        ,trigger: 'click'
        ,change: function(value, date){ //监听日期被切换
          lay('#startTimey').attr('value',value);
        }
        ,ready: function(value, date){
          lay('#startTimey').attr('value',startTimey);
        }
      });
      laydate.render({
        type:'date',
        elem: '#expireDateDiv'
        ,position: 'static'
        ,value: new Date()
        ,trigger: 'click'
        ,change: function(value, date){ //监听日期被切换
          lay('#expireDate').attr('value',value);
        }
        ,ready: function(value, date){
          lay('#expireDate').attr('value',expireDate);
        }

      });
      laydate.render({
        type:'time',
        elem: '#expireTimeyDiv'
        ,position: 'static'
        ,value: new Date(1534766888000)
        ,trigger: 'click'
        ,change: function(value, date){ //监听日期被切换
          lay('#expireTimey').attr('value',value);
        }
        ,ready: function(value, date){
          lay('#expireTimey').attr('value',expireTimey);
        }
      });
    });


  }
</script>
</body>
</html>
